package com.cosina.game.crystallight.engine;

import com.cosina.game.crystallight.model.enemy.Enemy;
import com.cosina.game.crystallight.model.profile.ProfileManager;
import com.cosina.game.crystallight.model.profile.Skill;

public class ManaFlask{
	private int mana = 350;
	public final int MAX;
	
	public final int[] DEFAULT_MANA_FOR_MANA_FLOW_LEVEL = {500,630,870,1190,1570,2000};
	
	final int MANA_FLOW_LEVEL; 
	
	public ManaFlask(){
		MANA_FLOW_LEVEL = ProfileManager.getCurrentProfile().skillManager.getLevel(Skill.MANA_FLOW);
		this.MAX = DEFAULT_MANA_FOR_MANA_FLOW_LEVEL[MANA_FLOW_LEVEL];
		this.mana = this.MAX/2;
	}
	
	
	public int getCurrent(){
		return mana;
	}
	
	public void used(int cost){
		this.mana -= cost;
	}
	
	public float getPercent(){
		return (mana + 0f) / getMax();
	}

	public int getMax() {
		return MAX;
	}

	public void up() {
		if(mana < MAX){
			mana ++;
		}
	}

	public void absorb(Enemy deadBody) {
		this.mana += deadBody.mana;
		if(this.mana > getMax()){
			this.mana = getMax();
		}
	}
}
